﻿using SUNRPA.CONTROLS.IMPL.util;
using Microsoft.Win32;
using RPAVIEW.views.controlLibrary;

namespace RPAVIEW.views.EditPage.flows.CopyFileN {
   
    public partial class Input:BaseParamViewAction{
        public Input() {
            InitializeComponent();
        }
        public override void UpdateSource() {
            this.waitCopyFile.GetBindingExpression(SelVarTextBox.text).UpdateSource();
            this.targetParentPath.GetBindingExpression(SelVarTextBox.text).UpdateSource();
            this.ifExist.GetBindingExpression(System.Windows.Controls.ComboBox.SelectedIndexProperty).UpdateSource();
        }

        private void selectFile(object sender, System.Windows.RoutedEventArgs e){
            OpenFileDialog openFileDlg = FileUtil.OpenFileSelectDialog(".*", "所有文件 (*.*)|*.*", string.Empty);
            bool? dialogResult = openFileDlg.ShowDialog();
            if (dialogResult ?? false) {
                this.waitCopyFile.Text = openFileDlg.FileName;
            }
        }

        private void SelectDir(object sender, System.Windows.RoutedEventArgs e) {
            System.Windows.Forms.FolderBrowserDialog saveDialog =  FileUtil.OpenFloderSelectDialog();
            System.Windows.Forms.DialogResult dialogResult = saveDialog.ShowDialog();
            //按下确定选择的按钮  
            if(dialogResult == System.Windows.Forms.DialogResult.OK) {
                //记录选中的目录
                this.targetParentPath.Text = saveDialog.SelectedPath;
            }
        }
    }
}
